<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        //1.累加器 数字的累加
        // var arr = [1,2,3,4,];
        // var res = arr.reduce(function(pre,current,index) {
        //     console.log(pre,current,index);
        //     return pre +current;
        // },0)
        // console.log(res);

        var arr = [1,2,3,4];
        var res = arr.reduce(function(pre,current) {
            pre.push(current+10);
            return pre;
        },[]);
        console.log(res);

    </script>
</body>
</html>